import { http } from "@/utils/http";
import type { HttpResult } from "@/utils/http/types";

export function queryFileTable(params) {
  return http.request<HttpResult>("get", "/admin/file/get/table", {
    params: params
  });
}

export function queryFileList(params) {
  return http.request<HttpResult>("get", "/admin/file/get/list", {
    params: params
  });
}

export function deleteFile(ids) {
  return http.request<HttpResult>("post", `/admin/file/delete/${ids}`);
}

export function downloadFile(data) {
  return http.request<HttpResult>("get", "/admin/file/download", {
    params: { id: data.id },
    responseType: "blob"
  });
}

export function addFile(params) {
  return http.request<HttpResult>("post", "/admin/file/insert", {
    data: params
  });
}

export function updateFile(params) {
  return http.request<HttpResult>("post", "/admin/file/update", {
    data: params
  });
}
